export default {
	data() {
		return {
			dataListReq: null,
			dataList: [],
			dataListPar: {},
			page: 1,
			limit: 20,

			refund_msg: [],
			day_time: '',
			sub_bill: ''
		};
	},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom() {
		// this.getDataList();
	},
	methods: {
		setDataListReq(req) {
			this.dataListReq = req
		},
		setDataListPar(par) {
			this.dataListPar = par
		},
		resetDataList() {
			this.dataList = []
		},
		getDataList() {
			let that = this;
			if (!this.dataListReq) {
				return
			}
			this.dataListReq({
				page: this.page,
				limit: this.limit,
				...this.dataListPar
			}).then(res => {

				res.data.list.forEach(i => {
					if (i.intro) {
						i.intro_list = i.intro.split('、')
					}
				})

				this.dataList = this.dataList.concat(res.data.list)
				if (res.data.refund_info) {
					this.refund_msg = res.data.refund_info.refund_msg
					this.day_time = res.data.refund_info.free_msg.day_time
					this.sub_bill = res.data.refund_info.free_msg.sub_bill
				}
				let list = res.data.list || [];
				let loadend = list.length < that.limit;
				that.loadend = loadend;
				that.loading = false;
				that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
				that.page = that.page + 1
			}).catch(er => {
				this.$util.Tips({
					title: er
				});
			})
		}
	}
};
